/**
 * Created by tanbingqin on 2019/7/8.
 */
import { messages } from "share/common";


export default {
  getFlightConfig(){
    return [
      {
        "fieldName": messages('setting.key687'/*出发城市*/),
        "key": "fromCities",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key688'/*到达城市*/),
        "key": "toCities",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key689'/*出发日期*/),
        "key": "departBeginDate",
        "type": "boolean",
        "value": false,
        "remark": messages('setting.key690'/*备注：通过设置浮动天数，可允许员工提前或延后出发。*/)
      },
      {
        "fieldName": messages('setting.key691'/*国内机票出发日期-浮动天数*/),
        "key": "departDate-floatDays",
        "type": "int",
        "value": 4,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key693'/*国际机票出发日期-浮动天数*/),
        "key": "departDate-inter-floatDays",
        "type": "int",
        "value": 4,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key694'/*返程日期*/),
        "key": "returnEndDate",
        "type": "boolean",
        "value": false,
        "remark": messages('setting.key690'/*备注：通过设置浮动天数，可允许员工提前或延后出发。*/)
      },
      {
        "fieldName": messages('setting.key695'/*国内机票返程日期-浮动天数*/),
        "key": "returnDate-floatDays",
        "type": "int",
        "value": 4,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key1831')/*国际机票返程日期-浮动天数*/,
        "key": "returnDate-inter-floatDays",
        "type": "int",
        "value": 4,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key696'/*提前预订天数*/),
        "key": "preBookingDays",
        "type": "int",
        "value": 0,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key697'/*出发开始时间*/),
        "key": "takeOffBeginTime",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key698'/*出发结束时间*/),
        "key": "takeOffEndTime",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key699'/*到达开始时间*/),
        "key": "arrivalBeginTime",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key700'/*到达结束时间*/),
        "key": "arrivalEndTime",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key701'/*国内出行人姓名*/),
        "key": "passengerList",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key702'/*国际出行人姓名*/),
        "key": "internationalPassengerList",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key703'/*出行人数*/),
        "key": "travelerCount",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key704'/*折扣*/),
        "key": "discount",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key705'/*价格*/),
        "key": "ticketPrice",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key706'/*舱等*/),
        "key": "seatClass",
        "type": "boolean",
        "value": false,
        "remark": ""
      }
    ]
  },

  getHotelConfig(){
    return [
      {
        "fieldName": messages('setting.key708'/*城市*/),
        "key": "city",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key701'/*国内出行人姓名*/),
        "key": "passenger",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key702'/*国际出行人姓名*/),
        "key": "internationalPassenger",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key710'/*房间数量*/),
        "key": "roomNumber",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key711'/*单价上限*/),
        "key": "maxPrice",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key712'/*单价下限*/),
        "key": "minPrice",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key713'/*入住日期*/),
        "key": "fromDate",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key714'/*入住日期-浮动天数*/),
        "key": "fromDate-floatDays",
        "type": "int",
        "value": null,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key715'/*结束日期*/),
        "key": "leaveDate",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key716'/*离店日期-浮动天数*/),
        "key": "leaveDate-floatDays",
        "type": "int",
        "value": null,
        "remark": ""
      }
    ]
  },

  getTrainConfig(){
    return [
      {
        "fieldName": messages('setting.key687'/*出发城市*/),
        "key": "fromCity",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key688'/*到达城市*/),
        "key": "toCity",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key689'/*出发日期*/),
        "key": "departBeginDate",
        "type": "boolean",
        "value": false,
        "remark": messages('setting.key690'/*备注：通过设置浮动天数，可允许员工提前或延后出发。*/)
      },
      {
        "fieldName": messages('setting.key718'/*出发日期-浮动天数*/),
        "key": "departDate-floatDays",
        "type": "int",
        "value": 4,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key709'/*出行人姓名*/),
        "key": "passengerList",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key705'/*价格*/),
        "key": "ticketPrice",
        "type": "boolean",
        "value": false,
        "remark": ""
      },
      {
        "fieldName": messages('setting.key719'/*座席*/),
        "key": "seatClass",
        "type": "boolean",
        "value": false,
        "remark": ""
      }
    ]
  },

  //初始化机票／火车浮动天数
  /**
   *
   * @param profile login profile
   * @param type 'start' 开始日期相关的浮动天数 'end' 结束日期相关的浮动天数
   * @param isInter true 国际的浮动天数 false 国内的浮动天数或者就是单纯的浮动天数（火车浮动天数不分国内国际）
   * @param floatDays  国内的浮动天数或者就是单纯的浮动天数 int类型，没有就是undefined或者null
   * @param interFloatDays  国际的浮动天数 int类型，没有就是undefined或者null
   */
  initFloatDaysNum(profile, type, isInter, floatDays, interFloatDays){
    let startDaysInProfile = null;
    let endDaysInProfile = null;
    if (profile['approval.start.float.days'] || profile['approval.start.float.days'] === 0) {
      startDaysInProfile = profile['approval.start.float.days'];
    }
    if (profile['approval.end.float.days'] || profile['approval.end.float.days'] === 0) {
      endDaysInProfile = profile['approval.end.float.days'];
    }

    let days = 4;
    if (type === 'start' && startDaysInProfile !== null) {
      days = startDaysInProfile;
    }
    if (type === 'end' && endDaysInProfile !== null) {
      days = endDaysInProfile;
    }
    if (!isInter && floatDays !== null && floatDays !== undefined) {
      days = floatDays;
    }
    if (isInter && interFloatDays !== null && interFloatDays !== undefined) {
      days = interFloatDays;
    }
    return days;
  },

  getCarConfig(){
    return {
      "travel": {
        "carRule": {
          "enable": false,
          "show": true,
          "required": true
        },
        "departureCity": {
          "enable": false,
          "show": true,
          "required": true
        },
        "startDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "destinationCity": {
          "enable": false,
          "show": true,
          "required": true
        },
        "endDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "returnCity": {
          "enable": false,
          "show": true,
          "required": true
        },
        "returnDate": {
          "enable": false,
          "show": true,
          "required": true
        }
      },
      "businessTripByDate": {
        "carRule": {
          "enable": false,
          "show": true,
          "required": true
        },
        "departureCity": {
          "enable": false,
          "show": true,
          "required": false
        },
        "startDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "carStandard": {
          "enable": false,
          "show": true,
          "required": false
        }
      },
      "businessTripByTimes": {
        "carRule": {
          "enable": false,
          "show": true,
          "required": true
        },
        "startDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "endDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "startTime": {
          "enable": false,
          "show": true,
          "required": true
        },
        "endTime": {
          "enable": false,
          "show": true,
          "required": true
        }
      },
      "carQuick": {
        "departureCity": {
          "enable": false,
          "show": true,
          "required": false
        },
        "startDate": {
          "enable": false,
          "show": true,
          "required": true
        },
        "useTimes": {
          "enable": false,
          "show": true,
          "required": false
        },
        "carStandard": {
          "enable": false,
          "show": true,
          "required": false
        }
      },
      "carPickup": {
        "departureCity": {
          "enable": false,
          "show": true,
          "required": true
        },
        "type": {
          "enable": false,
          "show": true,
          "required": true
        },
        "validDate": {
          "enable": false,
          "show": true,
          "required": false
        }
      }
    }
  }
}
